const zlib = require('zlib')
const fs = require('fs')

let rs = fs.createReadStream('upload/vue.min.js')
let ws = fs.createWriteStream('upload/vue.js.min.gz')

// 压缩
let gz = zlib.createGzip()

// gz相当于一个加工厂，流经过会得到处理
rs.pipe(gz).pipe(ws)

ws.on('finish',()=>{
    console.log('完成')
})